#include <unistd.h>
#include <mpi.h>
#include <iostream>
using namespace std;


int 
main(int argc, char * argv[])
{
  int rank;
  MPI_Status status;
  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  MPI_Datatype MPI_FFTW_COMPLEX;
  double sendbuf[2], recvbuf[2];

  sendbuf[0] = 1.0;
  sendbuf[1] = 2.0;

  MPI_Type_contiguous(2, MPI_DOUBLE, &MPI_FFTW_COMPLEX);
  MPI_Type_commit(&MPI_FFTW_COMPLEX);
 
  MPI_Sendrecv(&sendbuf, 1, MPI_FFTW_COMPLEX, 0, 99,
	  		   &recvbuf, 1, MPI_FFTW_COMPLEX, 0, 99,
			   MPI_COMM_WORLD, &status);
  if ( rank == 0)
	cout << recvbuf[0] << recvbuf[1] << endl;
  MPI_Type_free(&MPI_FFTW_COMPLEX);
  MPI_Finalize();
  return 0;
}

